package com.xiaochong.tir.manager.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.xiaochong.tir.common.data.po.ResearchReportList;
import com.xiaochong.tir.common.data.po.SyChannels;
import com.xiaochong.tir.common.data.po.SyLabel;
import com.xiaochong.tir.common.data.vo.ResearchReportListVo;
import com.xiaochong.tir.common.data.vo.serchReportGradeVo;
import com.xiaochong.tir.manager.config.druid.Operation;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;
import com.xiaochong.tir.common.data.po.SyResearchReport;
import com.xiaochong.tir.common.data.mapper.SyResearchReportMapper;
import org.springframework.transaction.annotation.Transactional;

/**
 * 此类为[基础代码]自动生成,已经拥有基本的增删改成操作 
 * <其他请自行扩展>
 * @author cx
 * @time 2018-04-28 10:39
 * 
 */
@Service
public class SyResearchReportService{
 
      
    @Autowired
	private SyResearchReportMapper syResearchReportDao;
	
	
	/**
     * 新增
     * @param entity 
     * @param session
     */
	@Operation
    @Transactional
    public int insertSelective (SyResearchReport entity) { 
     return this.syResearchReportDao.insertSelective(entity);
    }	
    
    /**
     * 批量新增
     * @param list 
     * @param session
     */
    public void insertBatch(List<SyResearchReport> list) {
           
          this.syResearchReportDao.insertBatch(list);
         
         
    }
    
    /**
     * 根据主键修改单条数据
     * @param entity 
     * @param session
     */
    @Operation
    @Transactional
    public int updateByPrimaryKey(SyResearchReport entity,SyResearchReport old) {
           return this.syResearchReportDao.updateByPrimaryKey(entity);
    }
    
    /**
     * 根据主键批量修改数据
     * @param list 
     * @param session
     */
    public void updateBatch(List<SyResearchReport> list) {
           
          this.syResearchReportDao.updateBatch(list);
          
        
    }
    
    /**
     * 根据主键查询单条数据
     * @param id
     */
    public SyResearchReport selectByPrimaryKey(Integer id) {
            return this.syResearchReportDao.selectByPrimaryKey(id);
    }
    
    /**
     * 根据条件查询单条记录
     * @param entity 
     */
    public SyResearchReport selectByEntity(SyResearchReport entity) {
           return this.syResearchReportDao.selectByEntity(entity);
    }
    
    
    /**
     * 根据条件查询多条记录
     * @param entity 
     */
    public List<SyResearchReport> selectByEntityList(SyResearchReport entity) {
           return  this.syResearchReportDao.selectByEntityList(entity);
    }
    
    /**
     * 根据条件查询Id
     * @param entity 
     */
    public Integer selectById(SyResearchReport entity) {
           return  this.syResearchReportDao.selectById(entity);
    }
    
     /**
     * 根据条件查询Ids
     * @param entity 
     */
    public List<Integer> selectByIds(SyResearchReport entity) {
        return  this.syResearchReportDao.selectByIds(entity);
    }
    
     /**
     * 根据主键删除单条记录
     * @param id
     */
     @Transactional
    public void deleteByPrimaryKey(Integer id) {
           this.syResearchReportDao.deleteByPrimaryKey(id);
    }
    
    /**
     * 根据主键删除多条记录
     * @param list
     */
    public void deleteBatch(List<Integer> list) {
           this.syResearchReportDao.deleteBatch(list);
    }
    
     /**
     * 根据某些条件删除
     * @param entity
     */
    public void deleteBatch(SyResearchReport entity) {
           this.syResearchReportDao.deleteByEntity(entity);
    }


    public List<ResearchReportList> SelectReport(Integer id) {
        return this.syResearchReportDao.SelectReport(id);
    }

    public PageInfo<serchReportGradeVo> serchReportList(ResearchReportListVo vo) {
        PageHelper.startPage(vo.getPage(), vo.getLimit());
        List<serchReportGradeVo> list = this.syResearchReportDao.serchReportList(vo);
        return new PageInfo<serchReportGradeVo>(list);
    }

    public List<SyChannels> ChannlList() {
        return this.syResearchReportDao.ChannlList();
    }

    public List<SyLabel> labelList() {
        return this.syResearchReportDao.labelList();
    }

    public List<SyResearchReport> selreportlist(SyResearchReport report) {
        return this.syResearchReportDao.selreportlist(report);
    }
}